import request from '@/utils/request'

// 查询告警信息列表
export function listAlarm(query) {
  return request({
    url: '/system/alarm/list',
    method: 'get',
    params: query
  })
}

// 查询告警信息详细
export function getAlarm(aId) {
  return request({
    url: '/system/alarm/' + aId,
    method: 'get'
  })
}

// 新增告警信息
export function addAlarm(data) {
  return request({
    url: '/system/alarm',
    method: 'post',
    data: data
  })
}

// 修改告警信息
export function updateAlarm(data) {
  return request({
    url: '/system/alarm',
    method: 'put',
    data: data
  })
}

// 删除告警信息
export function delAlarm(aId) {
  return request({
    url: '/system/alarm/' + aId,
    method: 'delete'
  })
}
// 获取充电站下拉列表
export function getStationList() {
  return request({
    url: '/system/alarm/stationList',
    method: 'get'
  })
}

// 获取指定充电站的告警分析数据
export function getAlarmAnalysis(stationId) {
  return request({
    url: '/system/alarm/analysis',
    method: 'get',
    params: { stationId }
  })
}
// 查询每日告警次数
export function getDailyAlarmCount(stationId, month) {
  return request({
    url: '/system/alarm/dailyCount',
    method: 'get',
    params: { stationId, month }
  })
}
// 查询每日告警时长占比
export function getDailyAlarmDurationPercent(stationId, month) {
  return request({
    url: '/system/alarm/dailyDurationPercent',
    method: 'get',
    params: { stationId, month }
  })
}
